package com.ruoyi.quality.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.CommonConstructionSpecificationsMapper;
import com.ruoyi.quality.domain.CommonConstructionSpecifications;
import com.ruoyi.quality.service.ICommonConstructionSpecificationsService;

/**
 * 施工规范分类Service业务层处理
 * 
 * @author lxg
 * @date 2024-02-26
 */
@Service
public class CommonConstructionSpecificationsServiceImpl implements ICommonConstructionSpecificationsService 
{
    @Autowired
    private CommonConstructionSpecificationsMapper commonConstructionSpecificationsMapper;

    /**
     * 查询施工规范分类
     * 
     * @param id 施工规范分类主键
     * @return 施工规范分类
     */
    @Override
    public CommonConstructionSpecifications selectCommonConstructionSpecificationsById(Long id)
    {
        return commonConstructionSpecificationsMapper.selectCommonConstructionSpecificationsById(id);
    }

    /**
     * 查询施工规范分类列表
     * 
     * @param commonConstructionSpecifications 施工规范分类
     * @return 施工规范分类
     */
    @Override
    public List<CommonConstructionSpecifications> selectCommonConstructionSpecificationsList(CommonConstructionSpecifications commonConstructionSpecifications)
    {
        return commonConstructionSpecificationsMapper.selectCommonConstructionSpecificationsList(commonConstructionSpecifications);
    }

    /**
     * 新增施工规范分类
     * 
     * @param commonConstructionSpecifications 施工规范分类
     * @return 结果
     */
    @Override
    public int insertCommonConstructionSpecifications(CommonConstructionSpecifications commonConstructionSpecifications)
    {
        commonConstructionSpecifications.setCreateTime(DateUtils.getNowDate());
        return commonConstructionSpecificationsMapper.insertCommonConstructionSpecifications(commonConstructionSpecifications);
    }

    /**
     * 修改施工规范分类
     * 
     * @param commonConstructionSpecifications 施工规范分类
     * @return 结果
     */
    @Override
    public int updateCommonConstructionSpecifications(CommonConstructionSpecifications commonConstructionSpecifications)
    {
        commonConstructionSpecifications.setUpdateTime(DateUtils.getNowDate());
        return commonConstructionSpecificationsMapper.updateCommonConstructionSpecifications(commonConstructionSpecifications);
    }

    /**
     * 批量删除施工规范分类
     * 
     * @param ids 需要删除的施工规范分类主键
     * @return 结果
     */
    @Override
    public int deleteCommonConstructionSpecificationsByIds(Long[] ids)
    {   int i =0;
        int returnNum  =  commonConstructionSpecificationsMapper.checkChild(ids);
        if(returnNum == 0) {
            i = commonConstructionSpecificationsMapper.deleteCommonConstructionSpecificationsByIds(ids);
        }
        return i;
    }

    /**
     * 删除施工规范分类信息
     * 
     * @param id 施工规范分类主键
     * @return 结果
     */
    @Override
    public int deleteCommonConstructionSpecificationsById(Long id)
    {
        return commonConstructionSpecificationsMapper.deleteCommonConstructionSpecificationsById(id);
    }
}
